require("../util.js");
require("../component/components.js");
require("../../jsMt/util.js");
// var userInfo=JSON.parse(localStorage.getItem("userInfo"));
var vm = new Vue({
    el:"#modifyNumber",
    data:{
        isClassify:false,
        uid:"",
        circleId:"",//圈子id
        loginUid:"",//用户id
        isMain:"",//是否是圈主  1 是  0不是
        memberInfo:{},
        pop: {
            question: "您确定要把TA踢出圈子？",
            show: false
        },
        number:""
    },
    mounted:function(){
        this.searchObject = this.getQueryStringArgs();
        this.circleId=this.searchObject&&this.searchObject.circleId;
        this.loginUid=this.searchObject&&this.searchObject.uid;
        // this.isMain=this.searchObject&&this.searchObject.isMain;
        //this.getGroupMemberInfo();
    },
    methods:{
        //后退
        getBack: function () {
            history.go(-1);
            // if(this.square==1){
            //     location.href="/friend/circleSquare";
            // }else{
            //     location.href="/friend?indexs=3";
            // }
        },
        bgimg:function(url){
            url = url?url:"";
            return {
                "background-image":'url("'+url+'"),url("")'
            }
        },
        /*获取查询字符对象*/
        getQueryStringArgs: function () {
            //取得查询字符串并去掉开头的问号
            var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
                args = {},
                items = qs.length ? qs.split("&") : [],
                item = null,
                name = null,
                value = null,
                len = items.length;
            for (var i = 0; i < len; i++) {
                item = items[i].split("=");
                name = item[0];
                value = item[1];
                if (name.length) {
                    args[name] = value;
                }
            }
            return args;
        },
        //获取成员
        getGroupMemberInfo:function(){
            var that=this;
            var data={
                loginUid:that.loginUid,
                circleId:that.circleId
            };
            this.ajax({url:"/friend/getGroupMemberInfo",data:data,dataType:"json",method:"post"},function(b){
                if(b.json.code==0&&b.json.data){
                    that.memberInfo=b.json.data;
                    that.number=that.memberInfo.length;
                }else{
                    vm.$refs.prompt.toast("获取成员失败！")
                }
            });
        },
        //是否踢出圈子弹框
        getIsClassify:function(id){
            if(id){this.uid=id;}
            this.pop.show=!this.pop.show;
        },
        // getNoisClassify:function(){
        //
        // },
        //踢出圈子
        kickOutGroup:function(){
            var that=this;
            that.getIsClassify();
            var data={
                loginUid:that.loginUid,
                circleId:that.circleId,
                uid:that.uid
            };
            //console.log(data);
            this.ajax({url:"/friend/kickOutGroup",data:data,dataType:"json",method:"post"},function(b){
                if(b.json.code==0){
                    vm.$refs.prompt.toast("踢出成员成功！");
                    that.getGroupMemberInfo();
                }else{
                    vm.$refs.prompt.toast("踢出成员失败！");
                }
            });
        }
    }
});